package com.zh.blog.security.config;

import com.zh.blog.security.component.AccessDecisionManagerImpl;
import com.zh.blog.security.component.FilterInvocationSecurityMetadataSourceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.access.AccessDecisionManager;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.access.intercept.FilterInvocationSecurityMetadataSource;

/**
 * SpringSecurity通用配置
 * 包括通用Bean、Security通用Bean
 * @author ZhengHao
 * Created At 2022/7/29.
 **/
@Configuration
public class CommonSecurityConfig {

    @Bean
    public FilterInvocationSecurityMetadataSource securityMetadataSource(){
        return new FilterInvocationSecurityMetadataSourceImpl();
    }

    @Bean
    public AccessDecisionManager accessDecisionManager(){
        return new AccessDecisionManagerImpl();
    }

    @Bean
    public SessionRegistry sessionRegistry(){
        return new SessionRegistryImpl();
    }

}